package com.liyiqing.secondhandmall.productservice.service.impl;

import com.liyiqing.commonservice.utils.R;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liyiqing.commonservice.utils.PageUtils;
import com.liyiqing.commonservice.utils.Query;

import com.liyiqing.secondhandmall.productservice.dao.ProductGroupDao;
import com.liyiqing.secondhandmall.productservice.entity.ProductGroupEntity;
import com.liyiqing.secondhandmall.productservice.service.ProductGroupService;

import javax.annotation.Resource;


@Service("productGroupService")
public class ProductGroupServiceImpl extends ServiceImpl<ProductGroupDao, ProductGroupEntity> implements ProductGroupService {

    @Resource
    private ProductGroupDao productGroupDao;


    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ProductGroupEntity> page = this.page(
                new Query<ProductGroupEntity>().getPage(params),
                new QueryWrapper<ProductGroupEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public R selectProductGroupByCatalogId(Long catalogId) {
        List<ProductGroupEntity> list = productGroupDao.selectProductGroupByCatalogId(catalogId);
        return R.ok().put("data",list);
    }
}